home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / sonido / mod-0.000 / mod-0 / mod / make_protos < prev    next >
Encoding:
Text File  |  1994-10-04  |  811 b   |  44 lines

  1. #!/bin/sh
  2.  
  3. # This script gets most prototypes right. Function-declarations with the
  4. # right-paren on another line gets missed.
  5. #
  6. # (C) 1994 Mikael Nordqvist (d91mn@efd.lth.se, mech@df.lth.se)
  7. #
  8.  
  9. cat << EOF
  10. /*
  11.  *  protos.c - Prototypes for all functions.
  12.  *
  13.  *  (C) 1994 Mikael Nordqvist (d91mn@efd.lth.se, mech@df.lth.se)
  14.  */
  15.  
  16. /*
  17. EOF
  18. echo " *  Automagically generated "`date`"."
  19. cat << EOF
  20.  */
  21.  
  22. #ifndef _PROTOS_H
  23. #define _PROTOS_H
  24.  
  25. #include <sys/types.h>
  26. #include <linux/dirent.h>
  27.  
  28. /* User-defined types */
  29.  
  30. EOF
  31. for FILE in *.h; do
  32.   grep "^struct.*{" $FILE|sed "s/ *{$/;/"
  33. done
  34. echo
  35. echo "/* Function prototypes */"
  36. echo
  37. for FILE in *.c; do
  38.   echo "/* "$FILE" */"
  39.   grep "^[_a-zA-Z].*(.*)[ ]*$" $FILE|grep -v "^\(static\|inline\)"|sed -e "s/^/extern /" \
  40.     -e "s/$/;/"
  41.   echo
  42. done
  43. echo "#endif /* _PROTOS_H */"
  44.